<?php
include(str_replace("\\", "/", dirname(__FILE__))."/config.php"); 


////-------------------------------WEI BO-----------------------------------------
$sql = "select * from auto_account order by postnum asc limit 1";
$do_account = query($sql); 
$sql = "update auto_account set postnum = postnum + 1 where id = '".$do_account[0]['id']."'";
mysql_query($sql);

$param = array();
$user = substr($do_account[0]["user"], 0,strpos($do_account[0]["user"], "@"));
$param['uname'] = $do_account[0]["user"];
$param['pwd'] = $do_account[0]["psw"];
$cnwb = new CnwbBot($user);
$islogin = $cnwb->login($param);
print_r($islogin);
echo "<br><hr>";
echo date("Y-m-d H:i:s",time())."<br><hr>用户名:&nbsp;&nbsp;&nbsp;".$param['uname']."<br><hr>密码 :&nbsp;&nbsp;&nbsp;".$param['pwd']."<br><hr>";
die();
/////------------------------------------------------------------------------


$sql = "select * from auto_article where ispost = 0 and gettime > '".date("Y-m-d",strtotime("-1 day"))."' order by click desc limit 1";
$auto_article = query($sql);
if(isset($auto_article[0]['id'])){
	$article = $auto_article[0];
	$sql = "update auto_article set ispost=1 ,posttime = '".date("Y-m-d H:i:s",time())."' where id ='".$auto_article[0]['id']."'";
	mysql_query($sql);
	$post_top = get_posttop($article['tag']);
	$v7 = new v7("backcn","qingyu2007","http://auto825.com","auto825");
	$res_login = $v7->login();
	// print_r($res_login);die();
	$res_post = $v7->postA($article['catid'], mb_convert_encoding($article['title'], "GBK","UTF-8") ,mb_convert_encoding($article['content'], "GBK","UTF-8"),"" ,mb_convert_encoding($article['tag'], "GBK","UTF-8"),$post_top);
	print_r($res_post); 

}else{
	echo "no article post";
	//转发。点赞
}
?>